package com.imooc.town.service.impl;

import com.imooc.town.dataobject.ProductCategory;
import com.imooc.town.reponsitory.ProductCategoryReponsitory;
import com.imooc.town.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 10077 on 2018/3/21.
 * desc:
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private ProductCategoryReponsitory productCategoryReponsitory;

    @Override
    public ProductCategory getOne(Integer categoryId) {
        return productCategoryReponsitory.getOne(categoryId);
    }

    @Override
    public List<ProductCategory> getAll() {
        return productCategoryReponsitory.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return productCategoryReponsitory.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryReponsitory.save(productCategory);
    }
}
